package cj.web.marriage.dao;

import java.util.List;
import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.marriage.domain.SetMeal;

/**
 * 
 * @author 
 *
 */
@DAO
public interface SetMealDAO{
	
	@SQL("SELECT * FROM SetMeal WHERE deleteFlag = 1 AND name LIKE '%##(:t.name)%' LIMIT :t.start,:t.length ")
    List<SetMeal> query(@SQLParam("t") SetMeal setMeal);
	
	@SQL("SELECT count(1) FROM SetMeal WHERE deleteFlag = 1 AND name LIKE '%##(:t.name)%' ")
    int querysize(@SQLParam("t") SetMeal setMeal);
    
    @SQL("SELECT * FROM SetMeal WHERE id=:1 ")
    SetMeal queryById(int id);
    
    @SQL("INSERT INTO SetMeal (code,name,descs,deleteFlag) VALUES (:t.code,:t.name,:t.descs,1) ")
    void create(@SQLParam("t") SetMeal setMeal);
	
	@SQL("UPDATE SetMeal SET code=:t.code,name=:t.name,descs=:t.descs WHERE id=:t.id ")
    void update(@SQLParam("t") SetMeal setMeal);
    
    @SQL("UPDATE SetMeal SET deleteFlag = 0 WHERE id=:1 ")
    void deleteById(int id);
    
    @SQL("SELECT * FROM SetMeal WHERE deleteFlag = 1")
    List<SetMeal> queryAll();
    
}